//
//  CellOfSelect.m
//  HYHoney
//
//  Created by dllo on 16/2/23.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CellOfSelect.h"
#import "ModelOfImg.h"
#import "UIImageView+WebCache.h"
#import "PushOfSelect.h"
#import "DKNightVersion.h"

@implementation CellOfSelect

- (instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    
    if (self) {
        
        self.dk_backgroundColorPicker = DKColorWithRGB(0xFFFAFA, 0x27408B);
        self.contentView.dk_backgroundColorPicker = DKColorWithRGB(0xFFFAFA, 0x27408B);

        self.pic = [[UIImageView alloc] init];
        [self.contentView addSubview:self.pic];
        
        self.titleForPic = [[UILabel alloc] init];
        [self.contentView addSubview:self.titleForPic];
        
        [self.pic release];
        [self.titleForPic release];
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    
    self.pic.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.frame.size.height - 80);
    
    self.titleForPic.frame = CGRectMake(0, self.frame.size.height - 80, self.contentView.frame.size.width, 50);
    self.titleForPic.numberOfLines = 0;
    self.titleForPic.font = [UIFont boldSystemFontOfSize:13];
    self.titleForPic.dk_textColorPicker = DKColorWithRGB(0x000000, 0xefffff);
}


- (void)dealloc{

    [_pic release];
    [_titleForPic release];
    [super dealloc];
}



-(UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    
    return layoutAttributes;
}


- (void)layoutSubviews{
    
    [super layoutSubviews];
}


-(void)passModel:(ModelOfImg *)model{
    
    [self.pic sd_setImageWithURL:[NSURL URLWithString:model.simg]  placeholderImage:[UIImage imageNamed:@"jzz"]];
    
    self.titleForPic.text = [NSString stringWithFormat:@"  %@",model.title];
}

@end
